package day4;

import java.util.Arrays;

/**
 * @author oldliu
 * @since 1.0
 */
public class Calc {
    public int add(int []ar){
        int sum=0;
        for(int i:ar)
            sum+=i;

        return sum;
    }
    public int divide(int a,int ...b){
        System.out.println("数组的长度是:"+b.length);
        System.out.println(Arrays.toString(b));
        for(int i:b)
            a/=i;

        return a;
    }
    public static void main(String[] args) {
        //可变参数
        //>>>String.format()
        Calc c=new Calc();
        int r=c.add(new int[]{1,35,6,333});
        System.out.println(r);

        int r1 = c.divide(100);
        System.out.println(r1);
        int r2 = c.divide(10220,2,3,5,6,10);
        System.out.println(r2);
    }
//    public int add(int a,int b){
//        return a+b;
//    }

}
